<%@ Page Language="C#" MasterPageFile="~/MainMaster.master" AutoEventWireup="true"
    CodeFile="Forum.aspx.cs" Inherits="Community_Forum" Title="Community Forum " EnableEventValidation="false" %>
<%@ Register Assembly="Manager" Namespace="PagingControl" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainTable" runat="Server">
<script >
function CheckForumMessageIsBlank(txtdesc,lblmsg)
{ 
  if(document.getElementById(txtdesc).value=='')
    {               
    document.getElementById(lblmsg).innerHTML="Enter post message.";        
    return false
    }    
}
</script>

     <div class="heading_inner">
        <div class="heading_topic">
            <h2>News : <%=TopicName%></h2>
        </div>
    </div>

    <div class="cl"></div>

    <!--**Content 1 Starts Here**-->

    <div class="formnew_left" style="background-color: #f4f4f4;">
        <div style="width:98%;padding:1%;height:auto"><asp:Label ID="lblMsg" runat="server"></asp:Label></div>
        <div style="width:98%;padding:1%;height:auto">
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                    <tr>
                                        <td style="border-left: 1px solid #eaeaea; width: 8px;">
                                            <img src="<%=Session["strHttp"]%>images/spacer.gif" alt="" width="1" height="1"></td>
                                        <td style="text-align: left;">
                                            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                                <tr>
                                                    <td class="headernew" style="border-bottom: 1px solid #eaeaea; padding: 5px 0;" colspan="4">
                                                        <%=TopicName%>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td colspan="4">
                                                        <asp:Label ID="lblMessage" runat="Server" ForeColor="red" Font-Bold="true"></asp:Label></td>
                                                </tr>
                                                <tr>
                                                    <td style="border-bottom: 2px solid #eaeaea; padding: 5px 0;" colspan="4">
                                                        <asp:Panel ID="PostMessage" runat="Server">
                                                            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                                                <tr>
                                                                    <td style="border-bottom: 1px solid #eaeaea; padding: 10px 0; height: 20px;">
                                                                        <asp:TextBox ID="txtDescription" runat="Server" TextMode="multiline" CssClass="generaltext1"
                                                                            Style="width: 600px; height: 80px;" /></td>
                                                                </tr>
                                                                <tr>
                                                                    <td style="border-bottom: 1px solid #eaeaea; padding: 10px 0; height: 15px;" align="right">
                                                                        <asp:Button ID="btnSubmit" runat="server" CssClass="buttonclass" Text="Post Message"  OnClick="btnSubmit_Click1" />
                                                                        </td>
                                                                </tr>
                                                                <tr>
                                                                    <td>
                                                                        <p>
                                                                            Note: Your posting can be viewed by anyone. | <a href="#">Posting guidelines </a>
                                                                        </p>
                                                                    </td>
                                                                </tr>
                                                            </table>
                                                        </asp:Panel>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td style="border-bottom: 1px solid #eaeaea; padding: 10px 0; height: 20px;" colspan="4">
                                                        <a href="<%=Session["strHttp"]%>Community/community.aspx"> Recently active</a>    |  <a href="<%=Session["strHttp"]%>User/MySupportGroup.aspx?GrpId=<%=Session["TopicId"]%>">Add
                                                            to My Support Group</a>  |  <a href="<%=Session["strHttp"]%>Community/community.aspx">Back>></a>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td style="border-bottom: 1px solid #eaeaea; padding: 10px 0; height: 20px;">
                                                        <strong>Search questions containing:</strong></td>
                                                    <td width="45%" align="left" style="border-bottom: 1px solid #eaeaea; padding: 0px 0;
                                                        height: 20px;">
                                                        <asp:TextBox ID="txtSearch" runat="Server" CssClass="generaltext1" Width="80%"></asp:TextBox>
                                                    <td width="15%" align="center" style="border-bottom: 1px solid #eaeaea; padding: 10px 0;
                                                        height: 20px;">
                                                        <asp:Button ID="btnSearch" runat="Server" Text="Search"  CssClass="buttonclass" OnClick="btnSearch_Click" Font-Bold="true"
                                                            CausesValidation="False" />
                                                    </td>
                                                    <td width="10%" align="right" style="border-bottom: 1px solid #eaeaea; padding: 10px 0;
                                                        height: 20px;">
                                                        <strong>Responses</strong>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td colspan="4">
                                                        <asp:Repeater ID="rpQuestion" runat="Server">
                                                            <HeaderTemplate>
                                                                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                                            </HeaderTemplate>
                                                            <ItemTemplate>
                                                                <tr>
                                                                    <td width="9%" valign="top" align="left" style="border-bottom: 1px solid #eaeaea;
                                                                        padding: 10px 0;">
                                                                        <img src="<%=Session["strHttp"]%>images/no-image.gif" alt="" width="40" height="50"></td>
                                                                    <td width="78%" valign="top" style="border-bottom: 1px solid #eaeaea; padding: 10px 0;">
                                                                        <a href="<%=Session["strHttp"]%>Community/PostRespose.aspx?Mid=<%# Eval("Id")%>&Id=<%=Session["TopicId"]%>">
                                                                            <%# ((System.Data.DataRowView)Container.DataItem)["msg"]%>
                                                                            ... </a>
                                                                        <br>                                                                        
                                                                        <%# Convert.ToInt32(Eval("daydiffer")) > Convert.ToInt32("1") ? "Posted on  " + "<b>" + ((System.Data.DataRowView)Container.DataItem)["PostedDate"] + "</b>" : " "%>
                                                                        <%# (Convert.ToInt32(Eval("daydiffer")) <= Convert.ToInt32("1")) && (Convert.ToInt32(Eval("hour")) < Convert.ToInt32("25")) && (Convert.ToInt32(Eval("hour")) != Convert.ToInt32("0")) ? "Posted about " + ((System.Data.DataRowView)Container.DataItem)["hour"] + " hour " + ((System.Data.DataRowView)Container.DataItem)["Minute"] + " minute ago " : " "%>                                                                                                                                                                                                                        
                                                                        <%# (Convert.ToInt32(Eval("daydiffer")) <= Convert.ToInt32("1")) && (Convert.ToInt32(Eval("hour")) == Convert.ToInt32("0")) && (Convert.ToInt32(Eval("Minute")) >= Convert.ToInt32("1")) ? "Posted about " + ((System.Data.DataRowView)Container.DataItem)["Minute"] + " minute ago " : " "%>
                                                                        <%# (Convert.ToInt32(Eval("daydiffer")) <= Convert.ToInt32("1")) && (Convert.ToInt32(Eval("hour")) == Convert.ToInt32("0")) && (Convert.ToInt32(Eval("Minute")) < Convert.ToInt32("1")) ? "Posted about " + ((System.Data.DataRowView)Container.DataItem)["Minute"] + " minute ago " : " "%>
                                                                        
                                                                        
                                                                        by <b><%# ((System.Data.DataRowView)Container.DataItem)["username"]%></b>
                                                                    </td>
                                                                    <td width="13%" align="right" valign="top" style="border-bottom: 1px solid #eaeaea;
                                                                        padding: 10px 0;">
                                                                        <%#((System.Data.DataRowView)Container.DataItem) ["response"]%>
                                                                    </td>
                                                                </tr>
                                                            </ItemTemplate>
                                                            <FooterTemplate>
                                                                </table>
                                                            </FooterTemplate>
                                                        </asp:Repeater>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td height="35">
                                                        <cc1:Paging ID="pagingForum" runat="server" BindToControl="rpQuestion" OrderBy="PostedOn"
                                                            StoredProcedureName="GetForumQuestion" ResultsFormat="Displaying Question {0}-{1} (of {2})"
                                                            BackNextStyleClass="linkblue_12" ControlCssClass="normalgrey_12" PageNumbersCssClass="linkblue_12"
                                                            PageSize="10" Control_Type="Repeter" />
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>
                                        <td style="border-right: 1px solid #eaeaea;">
                                            <img src="<%=Session["strHttp"]%>images/spacer.gif" alt="" width="1" height="1"></td>
                                    </tr>
                                </table>
            </div>
        </div>
       

</asp:Content>
